package threadstart;

/**
 * Created by 5406160@qq.com on LiBoWen 李博闻.
 *
 * @ClassName : ThreadDemo5
 * @Author : 54061
 * @Date: 2022/2/15 15:01
 */
public class ThreadDemo5 {
    public static void main(String[] args) {
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println(Thread.currentThread().getName() + "阿珍 我爱你~" + i);
                }
            }
        }, "阿强:");

        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println(Thread.currentThread().getName() + "阿强 达咩~" + i);
                }
            }
        }, "阿珍:");

        //设置阿强为守护线程
        t1.setDaemon(true);

        t1.start();
        t2.start();
    }
}
